*Figure 8: GPA density functions*
clear all
use Clean_data, clear


*GPA standarization*
*Set boundaries* 
by year degree: egen GPA_min= min(GPA)
by year degree: egen GPA_max=max(GPA)

*Normalization*
drop GPA_Z
gen GPA_Z=(GPA-GPA_min)/GPA_max

***Period 1: 1983-1988*****
kdensity GPA_Z if female==1 & year<=1988 & degree=="M" & z_GPA!=. & foreign==0 & test==1 , addplot  (kdensity GPA_Z if female==0 & year<=1988 & degree=="M" & z_GPA!=. & foreign==0) ytitle("Probability Density") xtitle("") title("Period 1 (1983-1989)") graphregion(fcolor(white) lcolor(white)) ylab(,nogrid) scheme(s2mono)

***Period 2: 1989-2002*****
kdensity GPA_Z if female==1 & year>=1989 & year<=2002 & degree=="M" & z_GPA!=. & foreign==0 & test==1, addplot (kdensity GPA_Z if female==0 & year>=1989 & year<=2002 & degree=="M" & z_GPA!=. & foreign==0) ytitle("Probability Density") xtitle("") title("Period 2 (1989-2002)") graphregion(fcolor(white) lcolor(white)) ylab(,nogrid) scheme(s2mono) 

***Period 3: 2003-2011*****
kdensity GPA_Z if female==1 & year>=2003 & year<=2011 & degree=="M" & z_GPA!=. & foreign==0 & test==1 , addplot (kdensity GPA_Z if female==0 & year>=2003 & year<=2011 & degree=="M" & z_GPA!=. & foreign==0) ytitle("Probability Density") xtitle("") title("Period 3 (2003-2011)") graphregion(fcolor(white) lcolor(white)) ylab(,nogrid) scheme(s2mono) 

***Period 4 : 2012-2019*****
kdensity GPA_Z if female==1 &year>=2012 & degree=="M" & z_GPA!=. & foreign==0 & test==1, addplot (kdensity GPA_Z if female==0 & year>=2012 & degree=="M" & z_GPA!=. & foreign==0) ytitle("Probability Density") xtitle("") title("Period 4 (2012- 2019)") graphregion(fcolor(white) lcolor(white)) ylab(,nogrid) scheme(s2mono) 


*Combine four figures*
graph combine KP1.gph KP2.gph KP3.gph KP4.gph , graphregion(fcolor(white) lcolor(white))
